package com.mj.mapper;

import com.mj.entity.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

public interface BookMapper {
    @Select("select * from book where id = #{id}")
    public Book queryById(int id);
    @Select("select * from book")
    public List<Book> queryAll();
    @Insert("insert into book values(null,#{name},#{price},#{date})")
    public int insert(Book book);
    @Insert("insert into book values(null,#{name},#{price},#{date})")
    public int add(@Param("name") String name, @Param("price") double price, @Param("date") Date date);
    @Delete("delete from book where id = #{id}")
    public int deleteById(int id);
}
